package com.example.dql.diary.PictureSelection;

import android.support.annotation.Nullable;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.example.dql.diary.Model.PicDTO;
import com.example.dql.diary.R;

import java.util.List;

/**
 * Created by dql on 2018/2/24.
 */

public class PicAdapter extends BaseQuickAdapter<PicDTO,BaseViewHolder> {
    private  int picSize;
    public PicAdapter( @Nullable List<PicDTO> data) {
        super(R.layout.item_pic, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, PicDTO item) {
            if (item.isAdd()){
                helper.setVisible(R.id.iv_add,true);
                helper.setVisible(R.id.item_pic,false);
                helper.addOnClickListener(R.id.iv_add);
            }else {
                helper.setVisible(R.id.iv_add,false);
                helper.setVisible(R.id.item_pic,true);
                Glide.with(mContext).load(item.getImg()).into((ImageView) helper.getView(R.id.item_pic));
            }
//            Glide.with(mContext).load(item.getImgurl()).into((ImageView) helper.getView(R.id.item_pic));
//        Glide.with(mContext).load(R.drawable.addpic).into((ImageView) helper.getView(R.id.item_pic));
    }

}
